<?php
/* $data = FileCache::get('models_field_'.$modelid);   
print_r($data['fields']);
exit;*/
?>


<script>
$(function(){
	$.validator.addMethod("check_pattern", function(value, element, param) {
		return this.optional(element) || param.test(value); 
	}, "输入数据错误"); 
	
	$.validator.addMethod("check_rangelength", function(value, element, param) { 
		var length = value.length;
		for(var i = 0; i < value.length; i++){
			if(value.charCodeAt(i) > 127){
				length++;
			}
		}
		return this.optional(element) || ( length >= param[0] && length <= param[1] );   
	}, $.validator.format("{0}-{1}个字符之间(一个中文字算2个字符)"));



	$.validator.addMethod("check_ueditor", function(value, element, param) { 
		var content = param.getContent();
		if (content == ''){
			param.focus();
		}
		return content != ''; 
	}, "输入数据错误"); 
	
	
	
	$("#view-form-form").validate({	
		//debug:true,
		rules: {
	
		},    
	
		invalidHandler: function(form, validator) { //不通过回调 
			return false;
		},
		ignore: "",
		errorPlacement: function(error, element) {
			var error_element = $('#validate-error-'+element.attr('id'));
			if (error_element.length>0){
				 error.appendTo(error_element);
			}else{
				error.insertAfter(element);
			}
			
			
		}
	});
});

</script>